package logic

import (
	"gitee.com/DonHz/qimi/bluebell/dao/redis"
	"gitee.com/DonHz/qimi/bluebell/models"
	"go.uber.org/zap"
	"strconv"
)

func PostVote(userId int64, req models.VoteData) error {
	zap.L().Debug("PostVote()",
		zap.Int64("userId", userId),
		zap.Int64("article_id", req.ArticleId),
		zap.Int8("direction", req.Direction),
	)
	return redis.VoteForArticle(strconv.Itoa(int(userId)),
		strconv.Itoa(int(req.ArticleId)), float64(req.Direction))
}
